/*
 * Test to Liver.java
 * 15.06.2012
 */

package HumanTests;

import static org.junit.Assert.*;
import human.Liver;

import org.junit.Before;
import org.junit.Test;

/**
 * Tests to Liver.java
 * 
 * @author Vasyl Khyzhniak
 * @version 1.0
 */
public class LiverTest {

	Liver liverTest;
	@Before
	public void setUp() {
		liverTest = new Liver();
	}
	
	
	@Test
	public void shouldBeCorrectHealthWhenLiverCreated() {
		//given
		
		//when
		
		//then
		assertEquals(0,liverTest.getHealth());
	}
	
	@Test
	public void shouldBeCorrectCholesterolWhenLiverCreated() {
		//given
		
		//when
		
		//then
		assertEquals(0,liverTest.getCholesterol());
	}

	@Test
	public void shouldBeCorrectDetoxificationWhenLiverCreated() {
		//given
		
		//when
		
		//then
		assertEquals(0,liverTest.getDetoxification());
	}
	
	@Test
	public void shouldBeCorrectGlucoseWhenLiverCreated() {
		//given
		
		//when
		
		//then
		assertEquals(0,liverTest.getGlucose());
	}
	
	@Test
	public void shouldBeNecessaryForLifeWhenLiverCreated() {
		//given
		
		//when
		
		//then
		assertEquals(true,liverTest.getLifeImportance());
	}
	
	@Test
	public void shouldBeModifiedCholesterolWhenChanging() {
		//given
		
		//when
		liverTest.changeCholesterol(15);
		//then
		assertEquals(15,liverTest.getCholesterol());
	}
	
	@Test
	public void shouldBeModifiedDetoxificationWhenChanging() {
		//given
		
		//when
		liverTest.changeDetoxification(15);
		//then
		assertEquals(15,liverTest.getDetoxification());
	}
	
	@Test
	public void shouldBeModifiedGlucoseWhenChanging() {
		//given
		
		//when
		liverTest.changeGlucose(15);
		//then
		assertEquals(15,liverTest.getGlucose());
	}
	
	@Test
	public void shouldBeModifiedHealthWhenChanging() {
		//given
		
		//when
		liverTest.changeHealth(15);
		//then
		assertEquals(15,liverTest.getHealth());
	}

	@Test
	public void shouldControlLowerLimitWhenHealthModified() {
		//given
		
		//when
		liverTest.changeHealth(liverTest.getLowerLimit() - 10);
		//then
		assertEquals(liverTest.getLowerLimit(),liverTest.getHealth());
	}
	
	@Test
	public void shouldControlLowerLimitWhenCholesterolModified() {
		//given
		
		//when
		liverTest.changeCholesterol(liverTest.getLowerLimit() - 10);
		//then
		assertEquals(liverTest.getLowerLimit(),liverTest.getCholesterol());
	}
	
	@Test
	public void shouldControlLowerLimitWhenDetoxificationModified() {
		//given
		
		//when
		liverTest.changeDetoxification(liverTest.getLowerLimit() - 10);
		//then
		assertEquals(liverTest.getLowerLimit(),liverTest.getDetoxification());
	}
	
	@Test
	public void shouldControlLowerLimitWhenGlucoseModified() {
		//given
		
		//when
		liverTest.changeGlucose(liverTest.getLowerLimit() - 10);
		//then
		assertEquals(liverTest.getLowerLimit(),liverTest.getGlucose());
	}
	
	@Test
	public void shouldControlUpperLimitWhenHealthModified() {
		//given
		
		//when
		liverTest.changeHealth(liverTest.getUpperLimit() + 10);
		//then
		assertEquals(liverTest.getUpperLimit(),liverTest.getHealth());
	}
	
	@Test
	public void shouldControlUpperLimitWhenCholesterolModified() {
		//given
		
		//when
		liverTest.changeCholesterol(liverTest.getUpperLimit() + 10);
		//then
		assertEquals(liverTest.getUpperLimit(),liverTest.getCholesterol());
	}
	
	@Test
	public void shouldControlUpperLimitWhenDetoxificationModified() {
		//given
		
		//when
		liverTest.changeDetoxification(liverTest.getUpperLimit() + 10);
		//then
		assertEquals(liverTest.getUpperLimit(),liverTest.getDetoxification());
	}
	
	@Test
	public void shouldControlUpperLimitWhenGlucoseModified() {
		//given
		
		//when
		liverTest.changeGlucose(liverTest.getUpperLimit() + 10);
		//then
		assertEquals(liverTest.getUpperLimit(),liverTest.getGlucose());
	}
}
